# Contributor: Danct12 <danct12@disroot.org>
# Maintainer: Danct12 <danct12@disroot.org>
pkgname=fceux
pkgver=2.6.4
pkgrel=0
pkgdesc="Fast and ultra-compatible NES/Famicom emulator"
url="https://www.fceux.com"
arch="all"
license="GPL-2.0-only"
makedepends="bash cmake gd-dev glu-dev lua5.1-dev mesa-dev minizip-dev
	qt5-qtbase-dev sdl2-dev"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/project/fceultra/Source%20Code/$pkgver%20src/fceux-$pkgver.tar.gz"
options="!check" # no testsuite

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi

	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -d "$pkgdir/usr/share/doc/$pkgname"
	cp -r documentation/* "$pkgdir/usr/share/doc/$pkgname/"
	install -Dm644 changelog.txt "$pkgdir/usr/share/doc/$pkgname/"
	rm -f "$pkgdir/usr/share/$pkgname/"*.dll
}

sha512sums="
9fd8b908b652b5b8f120d15bdd43fa1e3475a300e0f1ec7d44965c95ec4bf58f7f9fe9511ea975effaf37f2cc4900e74021b06111dcafecc27affdd9d4e12f2e  fceux-2.6.4.tar.gz
"
